<include file="public/header" />
<link href="/static/admin/css/jquery.treeTable.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="margin: 15px;" class="user-main">
	<div class="user-title">
		<span class="fl">编辑平台角色权限</span>
		<div class="fr">
			<a  href="javascript:history.go(-1)"><button type="button" class="layui-btn-normal layui-btn-small bn write borderr5 cu " ><i class=" fa fa-reply"></i></button></a>
		</div>
		<div class="clear"></div>
	</div>
	<form class=" mt20 J_ajaxForm" action="{:url('Admin/roleJurisdiction')}" method="post">
		<div class="layui-form-item">
			<label class="layui-form-label">角色名称 :</label>
			<div class="layui-input-inline layui-wd">
				<input type="text" value="{$name}" readonly class="layui-input " >
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label"><span class="red">*</span>点击授权</label>
			<div class="layui-input-inline layui-wd2">
				<table width="100%" cellspacing="0" id="dnd-example">
					<tbody>
					{$categorys}
					</tbody>
				</table>
			</div>
		</div>
			<div class="layui-input-block">
			<input type="hidden" name="roleid" value="{$roleid}" />
			     <a class="layui-btn layui-btn-danger J_ajax_submit_savebtn" >确定授权</a>
		</div>
	</form>
</div>
<include file="public/footer" />
<script type="text/javascript" src="/static/admin/js/jquery.treeTable.js"></script>
<script>
	$("#dnd-example").treeTable({
		indent: 20
	});
	function checknode(obj) {
		var chk = $("input[type='checkbox']");
		var count = chk.length;
		var num = chk.index(obj);
		var level_top = level_bottom = chk.eq(num).attr('level');
		for (var i = num; i >= 0; i--) {
			var le = chk.eq(i).attr('level');
			if (eval(le) < eval(level_top)) {
				chk.eq(i).prop("checked", true);
				var level_top = level_top - 1;
			}
		}
		for (var j = num + 1; j < count; j++) {
			var le = chk.eq(j).attr('level');
			if (chk.eq(num).is(":checked")) {
				if (eval(le) > eval(level_bottom)){
					chk.eq(j).prop("checked", true);
				}
				else if (eval(le) == eval(level_bottom)){
					break;
				}
			} else {
				if (eval(le) > eval(level_bottom)){
					chk.eq(j).prop("checked", false);
				}else if(eval(le) == eval(level_bottom)){
					break;
				}
			}
		}
	}
</script>
</body>
</html>